package com.lyr;

import com.lyr.dao.UserRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author liyiruo
 * @Description
 * @Date 2024/8/15 下午4:15
 */
@SpringBootApplication
public class MysqlDBApp {
    public static void main(String[] args) {
        SpringApplication.run(MysqlDBApp.class, args);
    }

    @Bean
    public CommandLineRunner demo(UserRepository userRepository) {
        return (args) -> {
            int userCount = userRepository.countUsers();
            System.out.println("Total users: " + userCount);
        };
    }

}
